classdef theparser
    % theparser  [Not a public class] IRIS parser.
    %
    % Backend IRIS class.
    % No help provided.
    
    % -IRIS Toolbox.
    % -Copyright (c) 2007-2015 IRIS Solutions Team.
    
    properties
        FName = '';
        Code = '';
        Caller = '';
        Assign = struct();
        BlkName = cell(1,0);
        AltBlkName = cell(0,2);
        AltBlkNameWarn = cell(0,2);
        IxNameBlk = false(1,0);
        NameType = zeros(1,0,'single');
        IxStdcorrAllowed = false(1,0); % Stdcorr declarations allowed here.
        IxStdcorrBasis = false(1,0); % Stdcorr names derived from these names.
        IxEqtnBlk = false(1,0);
        EqtnType = zeros(1,0,'single');
        IxLogBlk = false(1,0);
        IxLoggable = false(1,0);
        IxEssential = false(1,0);
        BlkRegExpRep = cell(1,0);
        OtherKey = cell(1,0);
        AssignBlkOrd = cell(1,0); % Order in which values assigned to names will be evaluated.
    end
    
    
    
    
    methods
        function This = theparser(caller, fileName, code, assigned)
            if nargin==0
                return
            end
            % Initialise class-specific theta parser.
            This.Caller = caller;
            switch This.Caller
                case 'model'
                    This = model(This);
                case 'rpteq'
                    This = rpteq(This);
                otherwise
                    utils.error('theparser:theparser', ...
                        'Invalid caller class ''%s''.', ...
                        caller);
            end
            This.FName = fileName;
            This.Code = code;
            This.Assign = assigned;
        end
    end
    
    
    methods
        varargout = altsyntax(varargin)
        varargout = parse(varargin)
        varargout = readblk(varargin)
        varargout = specget(varargin)
    end
    
    
    methods (Static)
        varargout = blkpos(varargin)
        varargout = evaltimesubs(varargin)
        varargout = parseeqtns(varargin)
        varargout = parselog(varargin)
        varargout = parsenames(varargin)
        varargout = stdcorrix(varargin)
    end
    
    
    methods (Access=protected)
        varargout = model(varargin)
        varargout = rpteq(varargin)
    end
    
end
